package demo2;

import java.util.Random;

public class Demo3 {
    public static void main(String[] args) {
        //加上 -Xms1m -Xmx1m -XX:+PrintGCDetails
        String str = "study Java ";
        int count = 0;

        try {
            while(true){
                str += str + new Random().nextInt(1111111111) + new Random().nextInt(222222222);
                count++;
            }
        }catch (OutOfMemoryError error){
            System.out.println(count);
        }finally {
            System.out.println(count);

        }

    }
}
